#ifndef GLOBAL_H
#define GLOBAL_H

#include <QApplication>
#include <QObject>
#include <QWidget>
#include <QDateTime>
#include <QColor>
#include <QMap>
#include <QDir>
#include <QPair>
#include <QPen>
#include <QEvent>
#include <QPainter>
#include <QShowEvent>
#include <QImage>
#include <QBuffer>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <QPushButton>
#include <QFile>
#include <QLabel>

#include <QMouseEvent>

#include <QtDebug>

#define APPPATH     qApp->applicationDirPath()
#define CURDT       QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz");
#define CURDTFILE   CURDT+FILEEN;
#define CURDTIMAGE  CURDT+IMAGEEN;

namespace PW
{
    enum BUTTONFACE
    {
        _PEN=0,
        _PLOYGON,
        _ERASER,
        _PENSIZE,
        _LINECOLOR,
        _BACKGROUNDCOLOR,
        _UNDOCURVE,
        _CLEARCURVE,
        _PAINTLISE,
        _PAINTSAVE,
        _PAINTCLOSE
    };

    enum ModelType
    {
        FREELINE=0,
        ERASER,
        PLOYGON
    };

    enum PLOYGONTYPE
    {
        RECTANGLE=0,
        ELLIPOSE,
        RHOMBUS
    };

    struct PROPERTYDATA
    {
        PROPERTYDATA()
        {
            IsShow = true;
            IsSelect = false;
        }
        bool IsShow;                                    // 是否显示
        bool IsSelect;                                  // 是否选中
        QPen pen;                                       // 笔头
        ModelType Mt;                                   // 绘图类型
        PLOYGONTYPE Pt;                                 // 多边形类型
        QPair<QPoint,QPoint> BeginEndPoint;             // 起止点
        QList<QPoint> PaintData;                        // 线段数据
    };
}

namespace PAINTFILE
{
    const QString DIRNAME    = "Paint";
    const QString FILEEN     = ".pat";
    const QString IMAGEEN    = ".png";
}

namespace COLORS
{
    const QColor COLOR_Black = QColor(43,49,55);
    const QColor COLOR_Gray = QColor(146,146,146);
    const QColor COLOR_Green = QColor(0,255,42);
    const QColor COLOR_Red = QColor(255,0,0);
    const QColor COLOR_Orangle = QColor(255,174,0);
    const QColor COLOR_White = QColor(255,255,255);
    const QColor COLOR_Blue = QColor(36,0,255);
    const QColor COLOR_Purple = QColor(198,0,255);
    const QColor COLOR_Yellow = QColor(246,255,0);
    const QColor COLOR_Brown = QColor(185,122,87);
}

namespace SIZES
{
    const unsigned short SizeRate = 3;
}

#endif // GLOBAL_H
